package com.sstir.doctor.common;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * <p>
 *     分页Adaptor
 * </p>
 *
 * @author: fli
 * @email: fli@sstir.cn
 * @date: 2021/1/15 14:01
 */
public class PageAdaptor<T> {


    private final com.baomidou.mybatisplus.extension.plugins.pagination.Page<T> target;


    public PageAdaptor(org.springframework.data.domain.Page<T> source) {
        this.target = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<T>();
        target.setTotal(source.getTotalElements());
        target.setSize(source.getSize());
        target.setCurrent(source.getNumber() + 1);
        target.setRecords(source.getContent());
    }

    public Page<T> getTarget() {
        return target;
    }
}
